home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / macgzip_022-src / tailor.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-26  |  7.5 KB  |  345 lines  |  [TEXT/KAHL]

  1. /* tailor.h -- target dependent definitions
  2.  * Copyright (C) 1992-1993 Jean-loup Gailly.
  3.  * This is free software; you can redistribute it and/or modify it under the
  4.  * terms of the GNU General Public License, see the file COPYING.
  5.  */
  6.  
  7. /*
  8.  * Modified:1993 by SPDsoft for MacGzip
  9.  *
  10.  */
  11.  
  12.  
  13. /* The target dependent definitions should be defined here only.
  14.  * The target dependent functions should be defined in tailor.c.
  15.  */
  16.  
  17. /* $Id: tailor.h,v 0.18 1993/06/14 19:32:20 jloup Exp $ */
  18.  
  19. #if defined(__MSDOS__) && !defined(MSDOS)
  20. #  define MSDOS
  21. #endif
  22.  
  23. #if defined(__OS2__) && !defined(OS2)
  24. #  define OS2
  25. #endif
  26.  
  27. #if defined(OS2) && defined(MSDOS) /* MS C under OS/2 */
  28. #  undef MSDOS
  29. #endif
  30.  
  31. #ifdef MSDOS
  32. #  ifdef __GNUC__
  33.      /* DJGPP version 1.09+ on MS-DOS.
  34.       * The DJGPP 1.09 stat() function must be upgraded before gzip will
  35.       * fully work.
  36.       * No need for DIRENT, since <unistd.h> defines POSIX_SOURCE which
  37.       * implies DIRENT.
  38.       */
  39. #    define near
  40. #  else
  41. #    define MAXSEG_64K
  42. #    ifdef __TURBOC__
  43. #      define NO_OFF_T
  44. #      ifdef __BORLANDC__
  45. #        define DIRENT
  46. #      else
  47. #        define NO_UTIME
  48. #      endif
  49. #    else /* MSC */
  50. #      define HAVE_SYS_UTIME_H
  51. #      define NO_UTIME_H
  52. #    endif
  53. #  endif
  54. #  define PATH_SEP2 '\\'
  55. #  define PATH_SEP3 ':'
  56. #  define MAX_PATH_LEN  128
  57. #  define NO_MULTIPLE_DOTS
  58. #  define MAX_EXT_CHARS 3
  59. #  define Z_SUFFIX "z"
  60. #  define NO_CHOWN
  61. #  define PROTO
  62. #  define STDC_HEADERS
  63. #  define NO_SIZE_CHECK
  64. #  define casemap(c) tolow(c) /* Force file names to lower case */
  65. #  include <io.h>
  66. #  define OS_CODE  0x00
  67. #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
  68. #  if !defined(NO_ASM) && !defined(ASMV)
  69. #    define ASMV
  70. #  endif
  71. #else
  72. #  define near
  73. #endif
  74.  
  75. #ifdef OS2
  76. #  define PATH_SEP2 '\\'
  77. #  define PATH_SEP3 ':'
  78. #  define MAX_PATH_LEN  260
  79. #  ifdef OS2FAT
  80. #    define NO_MULTIPLE_DOTS
  81. #    define MAX_EXT_CHARS 3
  82. #    define Z_SUFFIX "z"
  83. #    define casemap(c) tolow(c)
  84. #  endif
  85. #  define NO_CHOWN
  86. #  define PROTO
  87. #  define STDC_HEADERS
  88. #  include <io.h>
  89. #  define OS_CODE  0x06
  90. #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
  91. #  ifdef _MSC_VER
  92. #    define HAVE_SYS_UTIME_H
  93. #    define NO_UTIME_H
  94. #    define MAXSEG_64K
  95. #    undef near
  96. #    define near _near
  97. #  endif
  98. #  ifdef __EMX__
  99. #    define HAVE_SYS_UTIME_H
  100. #    define NO_UTIME_H
  101. #    define DIRENT
  102. #    define EXPAND(argc,argv) \
  103.        {_response(&argc, &argv); _wildcard(&argc, &argv);}
  104. #  endif
  105. #  ifdef __BORLANDC__
  106. #    define DIRENT
  107. #  endif
  108. #  ifdef __ZTC__
  109. #    define NO_DIR
  110. #    define NO_UTIME_H
  111. #    include <dos.h>
  112. #    define EXPAND(argc,argv) \
  113.        {response_expand(&argc, &argv);}
  114. #  endif
  115. #endif
  116.  
  117. #ifdef WIN32 /* Windows NT */
  118. #  define HAVE_SYS_UTIME_H
  119. #  define NO_UTIME_H
  120. #  define PATH_SEP2 '\\'
  121. #  define PATH_SEP3 ':'
  122. #  define MAX_PATH_LEN  260
  123. #  define NO_CHOWN
  124. #  define PROTO
  125. #  define STDC_HEADERS
  126. #  define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
  127. #  include <io.h>
  128. #  include <malloc.h>
  129. #  ifdef NTFAT
  130. #    define NO_MULTIPLE_DOTS
  131. #    define MAX_EXT_CHARS 3
  132. #    define Z_SUFFIX "z"
  133. #    define casemap(c) tolow(c) /* Force file names to lower case */
  134. #  endif
  135. #  define OS_CODE  0x0b
  136. #endif
  137.  
  138. #ifdef MSDOS
  139. #  ifdef __TURBOC__
  140. #    include <alloc.h>
  141. #    define DYN_ALLOC
  142.      /* Turbo C 2.0 does not accept static allocations of large arrays */
  143.      void * fcalloc (unsigned items, unsigned size);
  144.      void fcfree (void *ptr);
  145. #  else /* MSC */
  146. #    include <malloc.h>
  147. #    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
  148. #    define fcfree(ptr) hfree(ptr)
  149. #  endif
  150. #else
  151. #  ifdef MAXSEG_64K
  152. #    define fcalloc(items,size) calloc((items),(size))
  153. #  else
  154. #    define fcalloc(items,size) malloc((size_t)(items)*(size_t)(size))
  155. #  endif
  156. #  define fcfree(ptr) free(ptr)
  157. #endif
  158.  
  159. #if defined(VAXC) || defined(VMS)
  160. #  define PATH_SEP ']'
  161. #  define PATH_SEP2 ':'
  162. #  define SUFFIX_SEP ';'
  163. #  define NO_MULTIPLE_DOTS
  164. #  define Z_SUFFIX "-gz"
  165. #  define RECORD_IO 1
  166. #  define casemap(c) tolow(c)
  167. #  define OS_CODE  0x02
  168. #  define OPTIONS_VAR "GZIP_OPT"
  169. #  define STDC_HEADERS
  170. #  define NO_UTIME
  171. #  define EXPAND(argc,argv) vms_expand_args(&argc,&argv);
  172. #  include <file.h>
  173. #  define unlink delete
  174. #  ifdef VAXC
  175. #    define NO_FCNTL_H
  176. #    include <unixio.h>
  177. #  endif
  178. #endif
  179.  
  180. #ifdef AMIGA
  181. #  define PATH_SEP2 ':'
  182. #  define STDC_HEADERS
  183. #  define OS_CODE  0x01
  184. #  define ASMV
  185. #  ifdef __GNUC__
  186. #    define DIRENT
  187. #    define HAVE_UNISTD_H
  188. #  else /* SASC */
  189. #    define NO_STDIN_FSTAT
  190. #    define SYSDIR
  191. #    define NO_SYMLINK
  192. #    define NO_CHOWN
  193. #    define NO_FCNTL_H
  194. #    include <fcntl.h> /* for read() and write() */
  195. #    define direct dirent
  196.      extern void _expand_args(int *argc, char ***argv);
  197. #    define EXPAND(argc,argv) _expand_args(&argc,&argv);
  198. #    undef  O_BINARY /* disable useless --ascii option */
  199. #  endif
  200. #endif
  201.  
  202. #if defined(ATARI) || defined(atarist)
  203. #  ifndef STDC_HEADERS
  204. #    define STDC_HEADERS
  205. #    define HAVE_UNISTD_H
  206. #    define DIRENT
  207. #  endif
  208. #  define ASMV
  209. #  define OS_CODE  0x05
  210. #  ifdef TOSFS
  211. #    define PATH_SEP2 '\\'
  212. #    define PATH_SEP3 ':'
  213. #    define MAX_PATH_LEN  128
  214. #    define NO_MULTIPLE_DOTS
  215. #    define MAX_EXT_CHARS 3
  216. #    define Z_SUFFIX "z"
  217. #    define NO_CHOWN
  218. #    define casemap(c) tolow(c) /* Force file names to lower case */
  219. #    define NO_SYMLINK
  220. #  endif
  221. #endif
  222.  
  223. #ifdef MACOS
  224.  
  225. #  define NO_DIRENT
  226. #  define UTIME
  227. #  define STDC_HEADERS
  228. #  define HAVE_UNISTD_H
  229. #  define NO_SYMLINK
  230. /*#  define NO_MULTIPLE_DOTS*/
  231. #  define NO_CHOWN
  232. #  define PROTO
  233. #  define DYN_ALLOC
  234. #  define MAXSEG_64K
  235.  
  236. #  define SMALL_MEM /* por culpa del unlzw.c */
  237.  
  238. #  define PATH_SEP ':'
  239. #  define NO_STDIN_FSTAT
  240. /*#  define chmod(file, mode) (0)*/
  241. #  define OPEN(name, flags, mode) open(name, flags)
  242. #  define OS_CODE  0x07
  243. #  ifdef MPW
  244. #    define isatty(fd) ((fd) <= 2)
  245. #  endif
  246. #endif
  247.  
  248. #ifdef __50SERIES /* Prime/PRIMOS */
  249. #  define PATH_SEP '>'
  250. #  define STDC_HEADERS
  251. #  define NO_MEMORY_H
  252. #  define NO_UTIME_H
  253. #  define NO_UTIME
  254. #  define NO_CHOWN 
  255. #  define NO_STDIN_FSTAT 
  256. #  define NO_SIZE_CHECK 
  257. #  define NO_SYMLINK
  258. #  define RECORD_IO  1
  259. #  define casemap(c)  tolow(c) /* Force file names to lower case */
  260. #  define put_char(c) put_byte((c) & 0x7F)
  261. #  define get_char(c) ascii2pascii(get_byte())
  262. #  define OS_CODE  0x0F    /* temporary, subject to change */
  263. #  ifdef SIGTERM
  264. #    undef SIGTERM         /* We don't want a signal handler for SIGTERM */
  265. #  endif
  266. #endif
  267.  
  268. #if defined(pyr) && !defined(NOMEMCPY) /* Pyramid */
  269. #  define NOMEMCPY /* problem with overlapping copies */
  270. #endif
  271.  
  272. #ifdef TOPS20
  273. #  define OS_CODE  0x0a
  274. #endif
  275.  
  276. #ifndef unix
  277. #  define NO_ST_INO /* don't rely on inode numbers */
  278. #endif
  279.  
  280.  
  281.     /* Common defaults */
  282.  
  283. #ifndef OS_CODE
  284. #  define OS_CODE  0x03  /* assume Unix */
  285. #endif
  286.  
  287. #ifndef PATH_SEP
  288. #  define PATH_SEP '/'
  289. #endif
  290.  
  291. #ifndef casemap
  292. #  define casemap(c) (c)
  293. #endif
  294.  
  295. #ifndef OPTIONS_VAR
  296. #  define OPTIONS_VAR "GZIP"
  297. #endif
  298.  
  299. #ifndef Z_SUFFIX
  300. #  define Z_SUFFIX ".gz"
  301. #endif
  302.  
  303. #ifdef MAX_EXT_CHARS
  304. #  define MAX_SUFFIX  MAX_EXT_CHARS
  305. #else
  306. #  define MAX_SUFFIX  30
  307. #endif
  308.  
  309. #ifndef MAKE_LEGAL_NAME
  310. #  ifdef NO_MULTIPLE_DOTS
  311. #    define MAKE_LEGAL_NAME(name)   make_simple_name(name)
  312. #  else
  313. #    define MAKE_LEGAL_NAME(name)
  314. #  endif
  315. #endif
  316.  
  317. #ifndef MIN_PART
  318. #  define MIN_PART 3
  319.    /* keep at least MIN_PART chars between dots in a file name. */
  320. #endif
  321.  
  322. #ifndef EXPAND
  323. #  define EXPAND(argc,argv)
  324. #endif
  325.  
  326. #ifndef RECORD_IO
  327. #  define RECORD_IO 0
  328. #endif
  329.  
  330. #ifndef SET_BINARY_MODE
  331. #  define SET_BINARY_MODE(fd)
  332. #endif
  333.  
  334. #ifndef OPEN
  335. #  define OPEN(name, flags, mode) open(name, flags, mode)
  336. #endif
  337.  
  338. #ifndef get_char
  339. #  define get_char() get_byte()
  340. #endif
  341.  
  342. #ifndef put_char
  343. #  define put_char(c) put_byte(c)
  344. #endif
  345.